package com.chuanyang.driverh.mainhome.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.chuanyang.driverh.R;
import com.chuanyang.driverh.base.BaseListAdapter;
import com.chuanyang.driverh.response2.ResultAllotGoodsSuccess;
import com.chuanyang.driverh.utils.StringUtil;

import java.util.List;


public class GoodsForAllotSuccessAdapter extends BaseListAdapter<ResultAllotGoodsSuccess.DataBean.WaybillGoodsInfosBean> {
    private List<ResultAllotGoodsSuccess.DataBean.WaybillGoodsInfosBean> data;
    private Context mContext;

    public GoodsForAllotSuccessAdapter(Context context, List<ResultAllotGoodsSuccess.DataBean.WaybillGoodsInfosBean> data) {
        super(context, data);
        this.mContext = context;
        this.data = data;
    }


    @Override
    public View getZkView(final int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = View.inflate(mContext, R.layout.home_item_carplan_goods, null);
            new ViewHolder(convertView);
        }
        ViewHolder holder = (ViewHolder) convertView.getTag();
        ResultAllotGoodsSuccess.DataBean.WaybillGoodsInfosBean item = getItem(position);
        holder.tv_name.setText(item.getGoodsName());
        holder.tv_standand.setText(item.getGoodsStandard());
//        holder.tv_matirial.setText(item.getGoodsMaterial());
        holder.tv_weight.setText(StringUtil.getDouble(item.getDetailsWeight()+"")+"t");
//        holder.tv_num.setText(item.getDetailsNum()+"");

        return convertView;
    }

    class ViewHolder {
        TextView tv_name;
        TextView tv_standand;
//        TextView tv_matirial;
        TextView tv_weight;
//        TextView tv_num;
        public ViewHolder(View view) {
            tv_name = (TextView) view.findViewById(R.id.tv_name);
            tv_standand = (TextView) view.findViewById(R.id.tv_standand);
//            tv_matirial = (TextView) view.findViewById(R.id.tv_matirial);
            tv_weight = (TextView) view.findViewById(R.id.tv_weight);
//            tv_num = (TextView) view.findViewById(R.id.tv_num);
            view.setTag(this);
        }
    }


}
